<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <#if isManage==0>
    <title>流程代理授权</title>
    <#else>
    <title>代理配置管理</title>
    </#if>
<#include "/pubHeadStyle.html">
</head>
<body>

<!-- 表单布局 -->
<form class="layui-fluid bpmAuthorizeAdd layui-form" lay-filter="formTest" style="">
    <input type="hidden" id="agentType" name="agentType" value="${agentType}">  <!-- 入口标记 1为管理入口  0为普通入口 -->
    <input type="hidden" id="id" name="id" value="${agentSetting.id}" />
    <div class="layui-row" style="border-top: 1px solid #ccc;">
      <#if agentType==0 || agentType=='0'>
        <#--个人入口-->
        <input type="hidden" name="authid" class="layui-input" <#if (agentSetting.authId)??>value = "${agentSetting.authId}" <#else>value="0"</#if>  >
      <#else>
        <#--管理入口-->
        <div class="layui-col-md2">
            <label class="layui-form-label" style="text-align: right;line-height: 38px;">授权人：<span style="color:red;">*</span></label>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
                <input type="hidden" name="authid" class="layui-input" value = "${agentSetting.authId}" >
                <input readonly="readonly" type="text" name="authname" class="layui-input" value="${agentSetting.authName}">
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
                <a class="authnameXz layui-btn layui-btn-sm" ><span>选择授权人</span></a>
            </div>
        </div>
      </#if>
    </div>
    <div class="layui-row">
        <div class="layui-col-md2">
            <label class="layui-form-label" style="text-align: right;line-height: 38px;">授权类型：<span style="color:red;">*</span></label>
        </div>
        <div class="layui-col-md10">
            <div class="layui-input-block">
                <#if agentSetting?? >
                    <#--编辑页面-->
                    <input lay-filter="className" type="radio" name="authtype" value="0" title="全权代理" <#if agentSetting.authType=='0'> checked </#if> >
                    <input lay-filter="className" type="radio" name="authtype" value="1" title="部分代理" <#if agentSetting.authType=='1'> checked </#if> >
                    <input lay-filter="className" type="radio" name="authtype" value="2" title="条件代理" <#if agentSetting.authType=='2'> checked </#if> >
                <#else>
                    <#--新增页面-->
                    <input lay-filter="className" type="radio" name="authtype" value="0" title="全权代理"  >
                    <input lay-filter="className" type="radio" name="authtype" value="1" title="部分代理" checked >
                    <input lay-filter="className" type="radio" name="authtype" value="2" title="条件代理" >
                </#if>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md2">
            <label class="layui-form-label" style="text-align: right;line-height: 38px;">时间区间：<span style="color:red;">*</span></label>
        </div>
        <div class="layui-col-md10">
            <div class="layui-input-block">
                <input readonly="readonly" type="text" class="layui-input" id="startTime" <#if (agentSetting.startTime)?? && (agentSetting.endTime)?? > value="${agentSetting.startTime?string('yyyy-MM-dd')} 至 ${agentSetting.endTime?string('yyyy-MM-dd')}" </#if> >
            </div>
        </div>
    </div>
    <div class="layui-row agent">
        <div class="layui-col-md2">
            <div class="layui-form-label" style="text-align: right;line-height: 38px;">代理人：<span style="color:red;">*</span></div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
                <input type="hidden" name="agentid" class="layui-input" value="${agentSetting.agentId}" >
                <input readonly="readonly" type="text" name="agent" class="layui-input" value="${agentSetting.agent}" >
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
            <a class="windowButton layui-btn layui-btn-sm" ><span>选择...</span></a>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md2">
            <label class="layui-form-label" style="text-align: right;line-height: 38px;">是否启用：<span style="color:red;">*</span></label>
        </div>
        <div class="layui-col-md10">
            <div class="layui-input-block">
                <input type="radio" name="enabled" value="0" title="禁止"  <#if agentSetting.enabled=='0'> checked </#if>>
                <input type="radio" name="enabled" value="1" title="启用"  <#if agentSetting.enabled!='0'> checked </#if>>
            </div>
        </div>
    </div>
    <div class="layui-row process" style="display: none;">
        <div class="layui-col-md2">
            <div class="layui-form-label" style="text-align: right;line-height: 38px;">流程名称：<span style="color:red;">*</span></div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
                <input type="hidden" name="flowkey" class="layui-input" value="${agentSetting.flowKey}" >
                <input type="text" name="flowname" class="layui-input" disabled  value="${agentSetting.flowName}" >
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-block">
                <a class="technologicalProcess layui-btn layui-btn-sm" ><span>选择流程</span></a>
                <a class="agencyConditions layui-btn layui-btn-sm" ><span>设置代理条件</span></a>
                <span style="color:red;">*</span>
            </div>
        </div>
    </div>
        <div class="layui-col-md12" style="margin: 10px 0;">
            <a class="layui-btn processSelection" ><span>添加流程定义</span></a>
            <span style="color:red;">*</span>
        </div>
        <table class="table-detail layui-table" lay-filter="agentSettingTable" id="agentSettingTable">
            <thead>
            <tr>
                <th style="text-align: center;">流程名称</th>
                <th style="text-align: center;">管理</th>
            </tr>
            </thead>
            <tbody>
            <#if (agentSetting.agentDefList)?? >
                <#list agentSetting.agentDefList as agentDefList>
                    <tr>
                        <td style="text-align: center;"><span value="${agentDefList.flowKey}">${agentDefList.flowName}</span></td>
                        <td style="text-align: center;"><a class="layui-btn layui-btn-sm " id="delTr" itemidid="${agentDefList.flowKey}" ><span>删除</span></a></td>
                    </tr>
                </#list>
            </#if>
            </tbody>
        </table>

         <input lay-filter="agentCondition" id="agentCondition" name="agentCondition" style="display: none;"
            <#--条件代理授权JSON数据-->
            <#if (agentSetting.agentConditionList)?? >
                value='[
                    <#list agentSetting.agentConditionList as condition>
                        {"agent":"${condition.agent}","agentid":"${condition.agentId}","condition":${condition.condition}}<#sep>,</#sep>
                    </#list>
                 ]'
            </#if>
          >
</form>

<script>
    layui.config({
        base: serverPath.systemPath + staticPath.formPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','form','table','setter','laydate'],function(){
        var $ = layui.$;
        var form = layui.form;
        var table = layui.table;
        var setter = layui.setter;
        var laydate = layui.laydate;
        var id = "${conditionScript.id}";
        var dataTables = '${conditionScript.argument}';
        var isFirst = true;

        $('head').append('<link href="${ctx}/css/workflow.css" rel="stylesheet" type="text/css" />');
        // 滚动条显示
        $('.layui-layout-body').css('overflow','auto');

        /**
         * 编辑回显:
         *  代理权限的回显控制隐藏显示
         */
        classNameRadio($("input[name='authtype']:checked").val());

        //radio监听
        form.on('radio(className)', function(data){
            /*将此处逻辑提出去，便于编辑回显时直接调用该方法*/
            classNameRadio(data.value);
        });
        //代理权限类型单击改变时启用
        function classNameRadio(_authType) {
            switch (_authType) {
                case '0':
                    //全权代理
                    $('#agentSettingTable').hide().prev().hide();
                    $('.agent').show();
                    $('.process').hide();
                    break;
                case '1':
                    //部分代理
                    $('#agentSettingTable').show().prev().show();
                    $('.agent').show();
                    $('.process').hide();
                    break;
                case '2':
                    //条件代理
                    $('#agentSettingTable').hide().prev().hide();
                    $('.agent').hide();
                    $('.process').show();
                    break;
            }
        }

        //今天的时间
        var day2 = new Date();
        day2.setTime(day2.getTime());
        var s2 = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate();
        //执行一个laydate实例
        laydate.render({
            elem: '#startTime' //指定元素
            ,min:s2
            ,range: '至'
        });
        $('.authnameXz').click(function () {
            var userSelectorWin;
            var body;
            parent.layer.open({
                type: 2,
                title: '人员选择器',
                area: ['760px','585px'],
                btn:["保存","取消","撤销"],
                content:serverPath.systemPath + setter.sysLinkPath+ "dialog/view/singleSysUserDialog",
                success: function(layero, index){
                    body = parent.layer.getChildFrame('body',index);
                    userSelectorWin = parent.window[layero.find('iframe')[0]['name']];
                },
                yes:function (index,layero) {
                    //执行iframe页的save方法
                    userSelectorWin.saveData(index);
                    var theUserList = body.find("input[name=selectUser]").val();
                    if (theUserList){
                        var item = JSON.parse(theUserList);
                        var userId = item.userId;
                        var userName = item.fullName;
                        $("input[name='authid']").val(userId);
                        $("input[name='authname']").val(userName);
                    }
                    parent.layer.close(index);
                },
                btn3:function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            })
        });
        $('.windowButton').click(function () {
            var userSelectorWin;
            var body;
            parent.layer.open({
                type: 2,
                title: '人员选择器',
                area: ['760px','585px'],
                btn:["保存","取消","撤销"],
                content:serverPath.systemPath + setter.sysLinkPath+ "dialog/view/singleSysUserDialog",
                success: function(layero, index){
                    body = parent.layer.getChildFrame('body',index);
                    userSelectorWin = parent.window[layero.find('iframe')[0]['name']];
                },
                yes:function (index,layero) {
                    //执行iframe页的save方法
                    userSelectorWin.saveData(index);
                    var theUserList = body.find("input[name=selectUser]").val();
                    if (theUserList){
                        var item = JSON.parse(theUserList);
                        $("input[name='agent']").val(item.fullName);
                        $("input[name='agentid']").val(item.userId);
                    }
                        parent.layer.close(index);
                },
                btn3:function (index, layero) {
                    userSelectorWin.cancelData(index);
                    return false //开启该代码可禁止点击该按钮关闭
                }
            })
        });
        $('.agencyConditions').click(function () {
            if ($("input[name=flowkey]").val()){
                var actSelectWin;
                parent.layer.open({
                    type: 2,
                    title: '编辑条件脚本的配置',
                    resize:false,
                    skin: 'btn-class',
                    area: ['1000px', '630px'],
                    btn:["保存","关闭"],
                    content: serverPath.workflowPath + setter.workflowLinkPath + 'agentSetting/view/editCondition?flowKey='+$("input[name=flowkey]").val()+'&id=${agentSetting.id}',
                    shadeClose: false,
                    success: function(layero, index){
                        actSelectWin = parent.window[layero.find('iframe')[0]['name']];
                        // 初始化已选择的流程
                        // if(layui.authorizeActTableData.length > 0) {
                        //     actSelectWin.layui.actList = layui.authorizeActTableData;
                        // }
                    },
                    yes:function (index,layero) {
                        //获取iframe的body元素
                        var body = parent.layer.getChildFrame('body',index);
                        //得到iframe页的窗口对象
                        var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                        //执行iframe页的showMsg方法
                        var agentConditionList = [];
                        //是否关闭弹窗
                        var isClose = true;
                        //封装数据
                        $.each(body.find('fieldset'),function (k,v) {
                            var fieldsetNum = {};
                            fieldsetNum.agent=$(v).find('input[name=agent]').val();
                            fieldsetNum.agentid=$(v).find('input[name=agentid]').val();
                            //2019-12-16    新增判断：若代理人为空，则不能进行保存
                            if(!(fieldsetNum.agentid&&fieldsetNum.agent)){
                                parent.layer.msg("第"+(k+1)+"个代理人设置没有指定代理人！",{icon:5,time:2500});
                                return isClose = false;
                            }
                            var tableId = $(v).find('input[name=tableId]').val();
                            if(!tableId){
                                parent.layer.msg("未获取到流程表单绑定的自定义表！",{icon:5,time:2500});
                                return isClose = false;
                            }
                            fieldsetNum.condition={};
                            fieldsetNum.condition.tableId=tableId;
                            fieldsetNum.condition.condition=[];
                            $.each($(v).find('.ruleDiv').children('div'),function (index,value) {
                                var ruleDivNum = {};
                                if ($(value).find('.layui-form-label').attr('ruletype')==1){
                                    ruleDivNum.flowvarKey = $(value).find('select[name=flowvarKey]').val();
                                    ruleDivNum.optType = $(value).find('div.'+$(value).find('select[name=flowvarKey]').val()+'').attr('opttype');
                                    if ($(value).find('select[name=flowvarKey]').val()== 'startUser') {
                                        ruleDivNum.judgeCon1 = $(value).find('.startUser').find('select[name=judgeCon1]').val();
                                        ruleDivNum.judgeVal1 = $(value).find('input[name=startUserId]').val()+'&'+$(value).find('.startUser').find('input[name=judgeVal1]').val();
                                        ruleDivNum.conDesc = $(value).find('select[name=flowvarKey] option:selected').text()+$(value).find('.startUser').find('select[name=judgeCon1] option:selected').text()+$(value).find('.startUser').find('input[name=judgeVal1]').val();
                                    }else if ($(value).find('select[name=flowvarKey]').val()== 'flowRunId'){
                                        ruleDivNum.judgeCon1 = $(value).find('.flowRunId').find('select[name=judgeCon1]').val();
                                        ruleDivNum.judgeVal1 = $(value).find('.flowRunId').find('input[name=judgeVal1]').val();
                                        ruleDivNum.judgeCon2 = $(value).find('.flowRunId').find('select[name=judgeCon2]').val();
                                        ruleDivNum.judgeVal2 = $(value).find('.flowRunId').find('input[name=judgeVal2]').val();
                                        ruleDivNum.conDesc = $(value).find('select[name=flowvarKey] option:selected').text()+$(value).find('.flowRunId').find('select[name=judgeCon1] option:selected').text()+$(value).find('.flowRunId').find('input[name=judgeVal1]').val()+$(value).find('.flowRunId').find('select[name=judgeCon2] option:selected').text()+$(value).find('.flowRunId').find('input[name=judgeVal2]').val();
                                    } else if ($(value).find('select[name=flowvarKey]').val()=='businessKey') {
                                        ruleDivNum.judgeCon1 = $(value).find('.businessKey').find('select[name=judgeCon1]').val();
                                        ruleDivNum.judgeVal1 = $(value).find('.businessKey').find('input[name=judgeVal1]').val();
                                        ruleDivNum.conDesc = $(value).find('select[name=flowvarKey] option:selected').text()+$(value).find('.businessKey').find('select[name=judgeCon1] option:selected').text()+$(value).find('.businessKey').find('input[name=judgeVal1]').val();
                                    }
                                    ruleDivNum.ruleType=$(value).find('.layui-form-label').attr('ruletype');
                                }else {
                                    ruleDivNum.script = $(value).find('.script-add-role').text();
                                    ruleDivNum.conDesc = '脚本';
                                    ruleDivNum.ruleType = $(value).find('.layui-form-label').attr('ruletype');
                                }
                                if (index!=0){
                                    ruleDivNum.compType = $(value).find('.compTypeSel').val();
                                }
                                fieldsetNum.condition.condition.push(ruleDivNum);
                            });
                            agentConditionList.push(fieldsetNum);
                        });

                        //条件代理设置是否正确
                        if(isClose){
                            //填充代理条件，用于保存
                            $("#agentCondition").val(JSON.stringify(agentConditionList));
                            //关闭弹窗
                            parent.layer.close(index);
                        }
                    }
                });
            }else {
                parent.layer.msg("请先选择流程！",{time: 2500, icon:0});
            }

        });
        $('.technologicalProcess').click(function () {
            parent.layer.open({
                type: 2,
                title: '选择流程',
                resize:false,
                area: ['1000px', '585px'],
                btn:["选择","关闭"],
                skin: 'btn-class',
                content: serverPath.workflowPath  + setter.workflowLinkPath + 'actDefModel/view/selector',
                shadeClose: false,
                yes:function (index,layero) {
                    //获取iframe的body元素
                    var body = parent.layer.getChildFrame('body',index);
                    //得到iframe页的窗口对象
                    var iframeWin = parent.window[layero.find('iframe')[0]['name']];
                    //执行iframe页的showMsg方法
                    $('input[name=flowname]').val(body.find("input[name=selectedFlowName]").val());
                    $('input[name=flowkey]').val(body.find("input[name=selectedFlowKey]").val());
                    parent.layer.close(index);
                }
            });
        });
        table.on('row(agentSettingTable)', function(obj){
            var layEvent = obj.event; //获得 lay-event 对应的值
            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            };
        });

        //部分代理，删除流程定义
        $(document).on('click','#delTr',function () {
            var _this =$(this).parent().parent("tr");
            var _flowKey = $(this).attr("itemid");
            $.each(layui.authorizeActTableData,function (i,val) {
                if($(this)[0].defKey==_flowKey){
                    layui.authorizeActTableData.splice(i,1);
                    _this.remove();
                }
            })
        });

        $('.processSelection').click(function () {
            var actSelectWin;
            var body;
            parent.layer.open({
                type: 2,
                title: '选择流程',
                resize:false,
                area: ['1000px', '590px'],
                btn:["选择","关闭"],
                content: serverPath.workflowPath + setter.workflowLinkPath + 'bpmDefAuthorize/view/actDialog',
                shadeClose: false,
                success: function(layero, index){
                    body = parent.layer.getChildFrame('body',index);
                    actSelectWin = parent.window[layero.find('iframe')[0]['name']];
                    layui.authorizeActTableData= [];
                    if ($("#agentSettingTable tbody>tr").length>0){
                        $.each($("#agentSettingTable tbody>tr"),function (index,item) {
                            var authorizeActTableDatas={};
                            authorizeActTableDatas.defKey=$(item).find('td').eq(0).find('span').attr("value");
                            authorizeActTableDatas.defName=$(item).find('td').eq(0).find('span').text();
                            layui.authorizeActTableData.push(authorizeActTableDatas);
                        })
                    }
                    // 初始化已选择的流程
                    if(layui.authorizeActTableData!=undefined&&layui.authorizeActTableData.length > 0) {
                        actSelectWin.layui.actList = layui.authorizeActTableData;
                    }
                },
                yes: function(index,layero){
                    var theUserList = body.find("input[name=actList]").val();
                    if(theUserList!=="[]"){
                        layui.authorizeActTableData = JSON.parse(theUserList);
                        var tr = '';
                        if (layui.authorizeActTableData.length>0){
                            tr = '';
                            $.each(layui.authorizeActTableData,function (index,value) {
                                tr += '<tr><td style="text-align: center;"><span value="'+value.defKey+'">'+value.defName+'</span></td><td style="text-align: center;"><a class="layui-btn layui-btn-sm "  id="delTr" itemid="'+value.defKey+'"><span>删除</span></a></td></tr>'
                            })
                        }
                        $('#agentSettingTable>tbody').html(tr);
                    }else {
                        layui.authorizeActTableData = [];
                        $('#agentSettingTable>tbody').html("");
                    }
                    parent.layer.close(index);
                }
            });
        });
        //渲染脚本所在类的类名——初始化
        var className = $("select[name=className]").val();
        if(!className)return;
        var match = /^.*\.(\w*)$/.exec(className),
            name = '';
        if(match!=null){
            name = match[1];
        }
        if(!name)return;
        name = name.toLowerCase().split("",1) + name.slice(1);
        $("input[name='classInsName']").val(name);
        if(id&&isFirst){
            methodNameAdd("${conditionScript.className}");
        }else {
            methodNameAdd(className);
        }
        //方法名联动
        form.on('select(className)', function(data){
            var className = data.value;
            if(!className)return;

            var match = /^.*\.(\w*)$/.exec(className),
                name = '';
            if(match!=null){
                name = match[1];
            }
            if(!name)return;
            name = name.toLowerCase().split("",1) + name.slice(1);
            $("input[name='classInsName']").val(name);
            methodNameAdd(data.value);
        });
        //加载所属方法名
        function methodNameAdd(methodNameData) {
            $.ajax({
                type: 'POST',
                url: serverPath.workflowPath + setter.workflowLinkPath + 'conditionScript/getMethodsByName',
                data: {name:methodNameData},
                dataType:'json',
                success: function(data){
                    $("select[name=methodName]").html("");
                    if (data.code==0) {
                        if (data.data.length>0){
                            $.each(data.data, function(key, val) {
                                var option2 = $("<option>").val(val.methodName).text(val.methodName);
                                $("select[name=methodName]").append(option2);
                            });
                            $("input[name=returnType]").val(data.data[0].returnType);
                            //第一个表格实例
                            conditionScriptEditTable(data.data[0].para);
                        }else {
                            $("select[name=methodName]").html("");
                            var data = [];
                            conditionScriptEditTable(data);
                            $("input[name=returnType]").val('');
                        }
                    }
                    form.render('select');
                }
            });
            //参数信息联动
            form.on('select(methodName)', function(choiceData){
                $.ajax({
                    type: 'POST',
                    url: serverPath.workflowPath + setter.workflowLinkPath + 'conditionScript/getMethodsByName',
                    data: {name:methodNameData},
                    dataType:  'json',
                    success: function(data){
                        $.each(data.data, function(key, val) {
                            if (choiceData.value==val.methodName){
                                conditionScriptEditTable(val.para);
                            }
                        });
                    }
                });
            });
        };
        //表格实例
        function conditionScriptEditTable(data) {
            table.render({
                elem: '#conditionScriptEditTable'
                ,page: false //开启分页
                ,data:data
                ,cols: [[ //表头
                    {field: 'paraName', title: '参数信息'}
                    ,{field: 'paraType', title: '参数类型', sort: true}
                    ,{
                        field: 'paraDesc',
                        title: '参数说明',
                        templet: function(d){
                            return '<input type="text" name="paraDesc" value="'+d.paraDesc+'" lay-filter="paraDesc" placeholder="请输入" autocomplete="off" class="layui-input">'
                        }
                    }
                    ,{field: 'paraCt', title: '控件类型', templet:'#controlType'}
                ]]
                ,done: function(res, curr, count){
                    //数据渲染完的回调。
                    //由于layui 设置了超出隐藏，所以这里改变下，以兼容操作按钮的下拉菜单
                    $(".layui-table-body, .layui-table-box, .layui-table-cell").css('overflow', 'visible');
                    form.on('select(paraCt)', function(choiceData){
                        if (choiceData.value==0){
                            $(choiceData.othis).eq(0).siblings('span').show();
                        }else {
                            $(choiceData.othis).eq(0).siblings('span').hide();
                        }
                    });
                }
            });
            // 如果是修改，数据回显
            if(id&&isFirst){
                var dataTable = $.parseJSON(dataTables);
                if (dataTable.length>0){
                    table.render({
                        elem: '#conditionScriptEditTable'
                        // ,height: 312
                        ,page: false //开启分页
                        ,data:dataTable
                        ,cols: [[ //表头
                            {field: 'paraName', title: '参数信息'}
                            ,{field: 'paraType', title: '参数类型', sort: true}
                            ,{
                                field: 'paraDesc',
                                title: '参数说明',
                                templet: function(d){
                                    return '<input type="text" name="paraDesc" value="'+d.paraDesc+'" lay-filter="paraDesc" placeholder="请输入" autocomplete="off" class="layui-input">'
                                }
                            }
                            ,{field: 'paraCt', title: '控件类型', templet:'#controlType'}
                        ]]
                        ,done: function(res, curr, count){
                            //数据渲染完的回调。
                            $.each(dataTable,function (index,value) {
                                $("select[name=paraCt]").eq(index).val(value.paraCt);
                                if (value.target||value.dialog) {
                                    $("select[name=paraCt]").eq(index).siblings("#settingSpan").show();
                                    $("select[name=paraCt]").eq(index).siblings("#settingSpan").find("select[name=dialog-type]").val(value.dialog);
                                    $("select[name=paraCt]").eq(index).siblings("#settingSpan").find("select[name=dialog-param]").val(value.target);
                                }
                            })
                            //由于layui 设置了超出隐藏，所以这里改变下，以兼容操作按钮的下拉菜单
                            $(".layui-table-body, .layui-table-box, .layui-table-cell").css('overflow', 'visible');
                            form.on('select(paraCt)', function(choiceData){
                                if (choiceData.value==0){
                                    $(choiceData.othis).eq(0).siblings('span').show();
                                }else {
                                    $(choiceData.othis).eq(0).siblings('span').hide();
                                }
                            });
                        }
                    });
                    form.val("formTest", {
                        "className": "${conditionScript.className}", // "name": "value"
                        "classInsName": "${conditionScript.classInsName}", // "name": "value"
                        "methodName": "${conditionScript.methodName}", // "name": "value"
                        "methodDesc": "${conditionScript.methodDesc}", // "name": "value"
                        "returnType": "${conditionScript.returnType}", // "name": "value"
                        "enable": "${conditionScript.enable}", // "name": "value"
                    })
                }
                isFirst=false;
            }
        };
    });
</script>
</body>
</html>